package com.Event;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.event.ApplicationContextEvent;
import org.springframework.stereotype.Component;

/**
 * @author cyt
 * @create 2020-08-01 17:37
 */
@Component
public class MsgSender {
    @Autowired
    private ApplicationContext contextEvent;

    public void send(String to) {
        System.out.println("send mail ....");
        MsgSendEvent event = new MsgSendEvent(contextEvent, to);
        contextEvent.publishEvent(event);
    }
}
